import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		login: false,
		Token: '',
		headImg: '../../static/uni-center/logo.png',
		userInfo: ''
	},
	mutations: {
		login(state, res) {
            console.log(state)
            console.log(res)
			state.login = true;
			state.token = res.token;
			state.userName = res.userInfo;
			state.headImg = res.headImg;
		},
		logout(state) {
			state.login = false;
			state.token = '';
			state.userName = '';
			state.headImg = '../../static/uni-center/logo.png';
		}
	}
})

export default store
